package sistemasdistribuidos;

import classesBase.ModelaTabela;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringStack;
import telasMensagem.bloqueio;

public class animaisCadastrados extends javax.swing.JDialog {

    int flag = 1;
    ModelaTabela modela = new ModelaTabela();

    public animaisCadastrados(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        tabela();
    }

    public animaisCadastrados(java.awt.Frame parent, boolean modal, int sele) {
        super(parent, modal);
        initComponents();
        flag = sele;
        jButtonDeletarCadastro.setText("Selecionar Animal");
        tabela();
    }

    public void tabela() {
        modela.setColumnIdentifiers(new String[]{"Código", "Nome", "Dono", "Telefone"});
        modela.addRow(new String[]{"123", "totó", "Faranush", "(19)3224-4000"});
        modela.addRow(new String[]{"456", "Tonto", "Fulano", "(19)4002-8922"});
        /*Preencher com dados do banco*/
        jTableAnimalCadastrados.setModel(modela);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTableAnimalCadastrados = new javax.swing.JTable();
        jTextFieldPesquisa = new javax.swing.JTextField();
        jLabelMsg10 = new javax.swing.JLabel();
        jComboBoxPesquisa = new javax.swing.JComboBox();
        jButtonBuscar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabelMsg13 = new javax.swing.JLabel();
        jTextFieldCodigoAnimal = new javax.swing.JTextField();
        jTextFieldNome = new javax.swing.JTextField();
        jLabelMsg3 = new javax.swing.JLabel();
        jLabelMsg12 = new javax.swing.JLabel();
        jTextFieldDono = new javax.swing.JTextField();
        jLabelMsg11 = new javax.swing.JLabel();
        jLabelMsg15 = new javax.swing.JLabel();
        jTextFieldPeso = new javax.swing.JTextField();
        jComboBoxEspecie1 = new javax.swing.JComboBox();
        jLabelMsg16 = new javax.swing.JLabel();
        jComboBoxRaca = new javax.swing.JComboBox();
        jLabelMsg9 = new javax.swing.JLabel();
        jFormattedDataNascimento = new javax.swing.JFormattedTextField();
        jTextFieldRegistro = new javax.swing.JTextField();
        jLabelMsg18 = new javax.swing.JLabel();
        jRadioButtonMasculino = new javax.swing.JRadioButton();
        jRadioButtonFeminino = new javax.swing.JRadioButton();
        jLabelMsg17 = new javax.swing.JLabel();
        jLabelMsg19 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTextPaneObservacoes = new javax.swing.JTextPane();
        jButtonBuscar1 = new javax.swing.JButton();
        jLabelMsg14 = new javax.swing.JLabel();
        jTextFieldCodigoDono = new javax.swing.JTextField();
        jLabelMsg21 = new javax.swing.JLabel();
        jButtonDeletarCadastro = new javax.swing.JButton();
        jButtonEditarCadastro = new javax.swing.JButton();
        jButtonEditarCadastro1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Animais Cadastrados");
        setAlwaysOnTop(true);

        jPanel1.setBackground(new java.awt.Color(255, 102, 0));
        jPanel1.setBorder(javax.swing.BorderFactory.createMatteBorder(3, 3, 3, 3, new java.awt.Color(0, 0, 0)));

        jTabbedPane2.setBackground(new java.awt.Color(255, 102, 0));
        jTabbedPane2.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N

        jPanel4.setBackground(new java.awt.Color(255, 102, 0));
        jPanel4.setBorder(javax.swing.BorderFactory.createMatteBorder(3, 3, 3, 3, new java.awt.Color(0, 0, 0)));

        jTableAnimalCadastrados.setBorder(javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, new java.awt.Color(0, 0, 0)));
        jTableAnimalCadastrados.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
        jTableAnimalCadastrados.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Código", "Nome", "Dono", "Telefone"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTableAnimalCadastrados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableAnimalCadastradosMouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(jTableAnimalCadastrados);

        jTextFieldPesquisa.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jTextFieldPesquisa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPesquisaActionPerformed(evt);
            }
        });

        jLabelMsg10.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg10.setText("Pesquisar:");

        jComboBoxPesquisa.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jComboBoxPesquisa.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nome", "Código", "Dono", "Telefone", "Raça" }));
        jComboBoxPesquisa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxPesquisaActionPerformed(evt);
            }
        });

        jButtonBuscar.setBackground(new java.awt.Color(255, 255, 255));
        jButtonBuscar.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jButtonBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Busca_Icon.png"))); // NOI18N
        jButtonBuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jButtonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabelMsg10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 308, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(16, 16, 16)
                        .addComponent(jComboBoxPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 598, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(12, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelMsg10)
                        .addComponent(jTextFieldPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jComboBoxPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButtonBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(45, 45, 45))
        );

        jTabbedPane2.addTab("Animais Cadastrados", jPanel4);

        jPanel3.setBackground(new java.awt.Color(255, 102, 0));
        jPanel3.setBorder(javax.swing.BorderFactory.createMatteBorder(3, 3, 3, 3, new java.awt.Color(0, 0, 0)));

        jLabelMsg13.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg13.setText("Código do Animal:");

        jTextFieldCodigoAnimal.setEditable(false);
        jTextFieldCodigoAnimal.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N

        jTextFieldNome.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jTextFieldNome.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextFieldNomeMouseClicked(evt);
            }
        });
        jTextFieldNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldNomeActionPerformed(evt);
            }
        });

        jLabelMsg3.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg3.setText("Nome:");

        jLabelMsg12.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg12.setText("<html><u>Dono:<u></html>");
        jLabelMsg12.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelMsg12MouseClicked(evt);
            }
        });

        jTextFieldDono.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jTextFieldDono.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldDonoActionPerformed(evt);
            }
        });

        jLabelMsg11.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg11.setText("Espécie:");

        jLabelMsg15.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg15.setText("Peso:");

        jTextFieldPeso.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N

        jComboBoxEspecie1.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jComboBoxEspecie1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione", "Cão", "Gato", "Pássaro", "Roedor" }));
        jComboBoxEspecie1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxEspecie1ActionPerformed(evt);
            }
        });

        jLabelMsg16.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg16.setText("Raça:");

        jComboBoxRaca.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jComboBoxRaca.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione" }));
        jComboBoxRaca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxRacaActionPerformed(evt);
            }
        });

        jLabelMsg9.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg9.setText("Data de Nascimento:");

        try {
            jFormattedDataNascimento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        jFormattedDataNascimento.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N

        jTextFieldRegistro.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N

        jLabelMsg18.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg18.setText("Registro:");

        jRadioButtonMasculino.setBackground(new java.awt.Color(255, 102, 0));
        buttonGroup1.add(jRadioButtonMasculino);
        jRadioButtonMasculino.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jRadioButtonMasculino.setText("Macho");

        jRadioButtonFeminino.setBackground(new java.awt.Color(255, 102, 0));
        buttonGroup1.add(jRadioButtonFeminino);
        jRadioButtonFeminino.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jRadioButtonFeminino.setSelected(true);
        jRadioButtonFeminino.setText("Fêmea");

        jLabelMsg17.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg17.setText("Sexo:");

        jLabelMsg19.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg19.setText("Observações:");

        jTextPaneObservacoes.setEditable(false);
        jTextPaneObservacoes.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jTextPaneObservacoes.setEnabled(false);
        jScrollPane6.setViewportView(jTextPaneObservacoes);

        jButtonBuscar1.setBackground(new java.awt.Color(255, 255, 255));
        jButtonBuscar1.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jButtonBuscar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Busca_Icon.png"))); // NOI18N
        jButtonBuscar1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jButtonBuscar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBuscar1ActionPerformed(evt);
            }
        });

        jLabelMsg14.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
        jLabelMsg14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/3545.png"))); // NOI18N

        jTextFieldCodigoDono.setEditable(false);
        jTextFieldCodigoDono.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabelMsg14)
                        .addGap(40, 40, 40)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jTextFieldCodigoDono, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButtonBuscar1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jTextFieldRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                            .addGap(4, 4, 4)
                                            .addComponent(jLabelMsg17)
                                            .addGap(18, 18, 18)
                                            .addComponent(jRadioButtonFeminino)
                                            .addGap(18, 18, 18)
                                            .addComponent(jRadioButtonMasculino)
                                            .addGap(37, 37, 37)
                                            .addComponent(jLabelMsg18))
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                            .addComponent(jLabelMsg15)
                                            .addGap(18, 18, 18)
                                            .addComponent(jTextFieldPeso, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(jLabelMsg9)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(jFormattedDataNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(jLabelMsg11)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jComboBoxEspecie1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabelMsg16)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jComboBoxRaca, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap(19, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabelMsg19)
                        .addGap(17, 17, 17)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabelMsg13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTextFieldCodigoAnimal, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelMsg3)
                            .addComponent(jLabelMsg12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jTextFieldNome)
                                .addGap(19, 19, 19))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jTextFieldDono, javax.swing.GroupLayout.PREFERRED_SIZE, 394, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(7, 7, 7)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelMsg13)
                    .addComponent(jTextFieldCodigoAnimal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelMsg3)
                    .addComponent(jTextFieldNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelMsg12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextFieldDono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextFieldCodigoDono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButtonBuscar1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelMsg11)
                            .addComponent(jComboBoxEspecie1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelMsg16)
                            .addComponent(jComboBoxRaca, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(15, 15, 15)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextFieldPeso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelMsg9, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jFormattedDataNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelMsg15))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelMsg17)
                            .addComponent(jRadioButtonFeminino)
                            .addComponent(jRadioButtonMasculino)
                            .addComponent(jLabelMsg18, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabelMsg14)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelMsg19, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane2.addTab("Detalhes", jPanel3);

        jLabelMsg21.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
        jLabelMsg21.setText("Animais Cadastrados");

        jButtonDeletarCadastro.setBackground(new java.awt.Color(255, 255, 255));
        jButtonDeletarCadastro.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jButtonDeletarCadastro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/limpar.png"))); // NOI18N
        jButtonDeletarCadastro.setText("Deletar Cadastro");
        jButtonDeletarCadastro.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jButtonDeletarCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDeletarCadastroActionPerformed(evt);
            }
        });

        jButtonEditarCadastro.setBackground(new java.awt.Color(255, 255, 255));
        jButtonEditarCadastro.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jButtonEditarCadastro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/pata.png"))); // NOI18N
        jButtonEditarCadastro.setText("Editar Cadastro");
        jButtonEditarCadastro.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jButtonEditarCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEditarCadastroActionPerformed(evt);
            }
        });

        jButtonEditarCadastro1.setBackground(new java.awt.Color(255, 255, 255));
        jButtonEditarCadastro1.setFont(new java.awt.Font("Segoe UI", 0, 16)); // NOI18N
        jButtonEditarCadastro1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/pata.png"))); // NOI18N
        jButtonEditarCadastro1.setText("Novo Cadastro");
        jButtonEditarCadastro1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jButtonEditarCadastro1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEditarCadastro1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabelMsg21)
                        .addGap(154, 154, 154))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jButtonEditarCadastro1, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButtonEditarCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(27, 27, 27)
                        .addComponent(jButtonDeletarCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 631, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButtonDeletarCadastro, jButtonEditarCadastro, jButtonEditarCadastro1});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabelMsg21)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonDeletarCadastro, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButtonEditarCadastro1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButtonEditarCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButtonEditarCadastro, jButtonEditarCadastro1});

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jTextFieldPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPesquisaActionPerformed

    }//GEN-LAST:event_jTextFieldPesquisaActionPerformed

    private void jComboBoxPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxPesquisaActionPerformed

    }//GEN-LAST:event_jComboBoxPesquisaActionPerformed

    private void jButtonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscarActionPerformed

    }//GEN-LAST:event_jButtonBuscarActionPerformed

    private void jButtonDeletarCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeletarCadastroActionPerformed
        if (flag == 0) {
            int linha = jTableAnimalCadastrados.getSelectedRows().length;
            if (linha > 1) {
                bloqueio b = new bloqueio(null, true, "<html>Por favor, selecione apenas um "
                        + "cadastro por vez!</html>");
                b.setLocationRelativeTo(null);
                b.setVisible(true);
            } else {
                agendaBanhoTosa.informacoes(jTextFieldNome.getText(),
                        jTextFieldDono.getText(),
                        Integer.parseInt(jTextFieldCodigoAnimal.getText()),
                        Integer.parseInt(jTextFieldCodigoDono.getText()));
            }
        } else {
            int linha = jTableAnimalCadastrados.getSelectedRows().length;
            if (linha > 1) {
                bloqueio b = new bloqueio(null, true, "<html>Por favor, selecione apenas um "
                        + "cadastro por vez!</html>");
                b.setLocationRelativeTo(null);
                b.setVisible(true);
            } else {
                try {
                    linha = jTableAnimalCadastrados.getSelectedRow();

                    /*deletar cadastro do banco*/
                    modela.removeRow(linha);

                } catch (NullPointerException ex) {
                    bloqueio b = new bloqueio(null, true, "<html>Por favor, selecione o cadastro "
                            + "deseja deletar!</html>");
                    b.setLocationRelativeTo(null);
                    b.setVisible(true);
                }
            }

        }
    }//GEN-LAST:event_jButtonDeletarCadastroActionPerformed

    private void jButtonEditarCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditarCadastroActionPerformed

    }//GEN-LAST:event_jButtonEditarCadastroActionPerformed

    private void jTextFieldNomeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextFieldNomeMouseClicked
        jTextFieldNome.setText(null);
    }//GEN-LAST:event_jTextFieldNomeMouseClicked

    private void jTextFieldDonoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldDonoActionPerformed

    }//GEN-LAST:event_jTextFieldDonoActionPerformed

    private void jComboBoxEspecie1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxEspecie1ActionPerformed

    }//GEN-LAST:event_jComboBoxEspecie1ActionPerformed

    private void jComboBoxRacaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxRacaActionPerformed

    }//GEN-LAST:event_jComboBoxRacaActionPerformed

    private void jButtonBuscar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscar1ActionPerformed

    }//GEN-LAST:event_jButtonBuscar1ActionPerformed

    private void jTextFieldNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldNomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldNomeActionPerformed

    private void jButtonEditarCadastro1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditarCadastro1ActionPerformed
        cadastroAnimal ca = new cadastroAnimal(null, true);
        ca.setLocationRelativeTo(null);
        ca.setVisible(true);
    }//GEN-LAST:event_jButtonEditarCadastro1ActionPerformed

    private void jTableAnimalCadastradosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableAnimalCadastradosMouseClicked
        int linha = jTableAnimalCadastrados.getSelectedRows().length;
        if (linha > 1) {
            bloqueio b = new bloqueio(null, true, "<html>Por favor, selecione apenas um "
                    + "cadastro por vez!</html>");
            b.setLocationRelativeTo(null);
            b.setVisible(true);
        } else {
            try {
                linha = jTableAnimalCadastrados.getSelectedRow();
                /*
                 SUBSTITUIR
                 preencher dados do banco nos campos*/
                jTextFieldCodigoAnimal.setText((String) jTableAnimalCadastrados.getValueAt(linha, 0));
                jTextFieldNome.setText((String) jTableAnimalCadastrados.getValueAt(linha, 1));
                jTextFieldDono.setText((String) jTableAnimalCadastrados.getValueAt(linha, 2));

            } catch (Exception ex) {
                bloqueio b = new bloqueio(null, true, "<html>Por favor, selecione o cadastro "
                        + "deseja deletar!</html>");
                b.setLocationRelativeTo(null);
                b.setVisible(true);
            }
        }
    }//GEN-LAST:event_jTableAnimalCadastradosMouseClicked

    private void jLabelMsg12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelMsg12MouseClicked
        /*Buscar dono no banco e abrir ficha*/
    }//GEN-LAST:event_jLabelMsg12MouseClicked
    public static void main(String args[]) {
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(animaisCadastrados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(animaisCadastrados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(animaisCadastrados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(animaisCadastrados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                animaisCadastrados dialog = new animaisCadastrados(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButtonBuscar;
    private javax.swing.JButton jButtonBuscar1;
    private javax.swing.JButton jButtonDeletarCadastro;
    private javax.swing.JButton jButtonEditarCadastro;
    private javax.swing.JButton jButtonEditarCadastro1;
    public static javax.swing.JComboBox jComboBoxEspecie1;
    public static javax.swing.JComboBox jComboBoxPesquisa;
    public static javax.swing.JComboBox jComboBoxRaca;
    public static javax.swing.JFormattedTextField jFormattedDataNascimento;
    private javax.swing.JLabel jLabelMsg10;
    private javax.swing.JLabel jLabelMsg11;
    private javax.swing.JLabel jLabelMsg12;
    private javax.swing.JLabel jLabelMsg13;
    private javax.swing.JLabel jLabelMsg14;
    private javax.swing.JLabel jLabelMsg15;
    private javax.swing.JLabel jLabelMsg16;
    private javax.swing.JLabel jLabelMsg17;
    private javax.swing.JLabel jLabelMsg18;
    private javax.swing.JLabel jLabelMsg19;
    private javax.swing.JLabel jLabelMsg21;
    private javax.swing.JLabel jLabelMsg3;
    private javax.swing.JLabel jLabelMsg9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JRadioButton jRadioButtonFeminino;
    private javax.swing.JRadioButton jRadioButtonMasculino;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTable jTableAnimalCadastrados;
    public static javax.swing.JTextField jTextFieldCodigoAnimal;
    public static javax.swing.JTextField jTextFieldCodigoDono;
    public static javax.swing.JTextField jTextFieldDono;
    public static javax.swing.JTextField jTextFieldNome;
    public static javax.swing.JTextField jTextFieldPeso;
    public static javax.swing.JTextField jTextFieldPesquisa;
    public static javax.swing.JTextField jTextFieldRegistro;
    public static javax.swing.JTextPane jTextPaneObservacoes;
    // End of variables declaration//GEN-END:variables
}
